Skip to content

Conversation

@FreeApophis
Copy link
Member

Main Idea:

I want a "IsBetween" extension on number types (just int in the experiment) which I can chose if the boundary are inclusive or exclusive.

12.IsBetween<Including, Excluding>(0, 20)

This was a lot easier than I thought, I defined a common interface IIntervalBoundary and two implementations Inclusive and Exclusive with private constructors and public implicit operators.

{
var position = 12;

Assert.True(position.IsBetween<Including, Excluding>(20, 0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea: InRange instead of IsBetween

@FreeApophis FreeApophis changed the title Experimental idea: IsBetween with explicit Inclusive and Exlusive boundatries Experimental idea: IsBetween with explicit Inclusive and Exlusive boundaries Apr 16, 2024
@bash bash closed this Feb 15, 2025
@bash bash deleted the experimental-is-between branch February 15, 2025 15:13
@bash bash restored the experimental-is-between branch February 15, 2025 15:20
@bash
Copy link
Member

bash commented Feb 15, 2025

Sorry for the noise, I was too eager in deleting branches 🙈

@bash bash reopened this Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants